package cn.edu.scau.cmi.houzhicong.factoryPattern.simpleFactory;


import cn.edu.scau.cmi.houzhicong.factoryPattern.domain.*;
import javafx.scene.image.Image;

public class SimpleInsuranceFactory {

    public static Insurance createInsurance(String insurance, String name, String stuNum, Image image) {
        if (insurance == null)
            return null;
        Insurance ins = null;
        switch (insurance) {
            case "身体受伤":
                ins = new BodilyInjury(name, stuNum, image);
                break;
            case "汽车损坏":
                ins = new CarDamage(name, stuNum, image);
                break;
            case "人员伤亡":
                ins = new HumanCasualty(name, stuNum, image);
                break;
            case "多种事故":
                ins = new MultipleAccidents(name, stuNum, image);
                break;
        }
        return ins;
    }
}
